package testRole{
	import flash.events.Event;
	import flash.geom.Rectangle;
	import flash.utils.ByteArray;
	import flash.utils.Endian;
	import morn.core.components.View;
	import morn.core.handlers.Handler;
	/**
	 * 一个带偏移量的动画测试
	 * @author SXL
	 */
	public class TestRole extends View{
		
		private static var _instance:TestRole;
		public static function get instance():TestRole{
			if(_instance) return _instance;
			return _instance=new TestRole();
		}
		
		public function start():void{
			App.scene.scene=this;
			App.loader.loadAssets(["1007.swf"],new Handler(this.onLoadComplete));
			//App.loader.loadSWF("1007.swf",new Handler(this.onLoadComplete));
		}
		
		private function onLoadComplete():void{
			var cla:Class=App.asset.getClass("CropInfo__");
			var data:ByteArray=new cla();
			data.uncompress();
			data.endian = Endian.LITTLE_ENDIAN;
			var count:uint = data.readUnsignedShort();
			for (var i:uint = 0; i < count; i++) {
				var rect:Rectangle = new Rectangle();
				rect.width = data.readUnsignedShort();  // 原始图像的宽度
				rect.height = data.readUnsignedShort(); // 原始图像的高度
				rect.x = data.readUnsignedShort();      // 剪裁的左上角点的x值
				rect.y = data.readUnsignedShort();      // 剪裁的左上角点的y值
				var linkName:String = data.readUTF();// 图像的linkName
				trace(linkName+"   "+rect);
			}
		}
	}
}